package novel.common.pojo;

import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
/**打包响应数据*/
@Getter@Setter@ToString@AllArgsConstructor@NoArgsConstructor@EqualsAndHashCode
public class JSONResponse {
	//1:success,0:error
	private int status;
	//错误描述
	private String errorDesc;
	//返回数据
	private Object successData;
	//正常
	public static JSONResponse success(Object successData) {
		JSONResponse response = new JSONResponse();
		response.setStatus(1);
		response.setSuccessData(successData);
		return response;
	}
	//异常
	public static JSONResponse error(String errorDesc) {
		JSONResponse response = new JSONResponse();
		response.setStatus(0);
		response.setErrorDesc(errorDesc);
		return response;
	}
}
